package com.wwtech.epp.ui.activity.main.module;

import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.wwtech.epp.data.api.HttpAPIWrapper;
import com.wwtech.epp.ui.activity.base.ActivityScope;
import com.wwtech.epp.ui.activity.main.ContactFragment;
import com.wwtech.epp.ui.activity.main.contract.ContactContract;
import com.wwtech.epp.ui.activity.main.presenter.ContactPresenter;
import com.wwtech.epp.ui.adapter.main.ContactAdapter;

import java.util.ArrayList;

import dagger.Module;
import dagger.Provides;

/**
 * @author hzp
 * @Package com.wwtech.epp.ui.activity.main
 * @Description: The moduele of ContactFragment, provide field for ContactFragment
 * @date 2017/08/21 11:13:55
 */
@Module
public class ContactModule {
    private final ContactContract.View mView;


    public ContactModule(ContactContract.View view) {
        this.mView = view;
    }

    @Provides
    @ActivityScope
    public ContactPresenter provideContactPresenter(HttpAPIWrapper httpAPIWrapper, ContactFragment mFragment) {
        return new ContactPresenter(httpAPIWrapper, mView, mFragment);
    }

    @Provides
    @ActivityScope
    public ContactFragment provideContactFragment() {
        return (ContactFragment) mView;
    }

    @Provides
    @ActivityScope
    public ArrayList<MultiItemEntity> provideList() {
        return new ArrayList<MultiItemEntity>();
    }

    @Provides
    @ActivityScope
    public ContactAdapter provideContactAdapter(ArrayList<MultiItemEntity> list) {
        return new ContactAdapter(list);
    }

}